import React, {Component} from 'react';
import {Modal, Button, Form} from 'antd';
import UserInfoForm from './UserInfoForm'

class UserModal extends Component {
    constructor(props) {
        super(props);
    }

    /*saveUserInfo(e) {
        e.preventDefault();
        this.props.validateFields((err, values) => {
            if (!err) {
                console.log('Received values of form: ', values);
            }
        });
    }*/

    render() {
        let action = this.props.action;
        let maskClosable = false;
        return (
            <Modal key={this.props.newRandomKey} title={this.props.title} visible={this.props.visible}
                   maskClosable={maskClosable}
                   onOk={() => this.props.saveUserInfo(action)} onCancel={this.props.handleCancel}>
                <UserInfoForm ref={this.props.saveFormRef} defaultValue={this.props.defaultValue}/>
            </Modal>
        )
    }
}

export default UserModal;
